# -*- coding: utf-8 -*-
# Gotacı, gnome için adsl kota gösterme aracıdır.
 # Copyright (C), 2009 Oğuzhan Eroğlu <oguzhan@oguzhaneroglu.com>
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.

 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.

import gtk
import sys
from settingsWindow import settingsWindow
import quotaWindow

gtk.gdk.threads_init()

menu = gtk.Menu()
menu.set_title("Gotacı")

def mainExit(event):
	print "Çıkılıyor..."
	sys.exit()

def showSettings(event):
	sW = settingsWindow()
	sW.show()

def kota(event):
	k = quotaWindow.quotaWindow()
	k.show()

exitButton = gtk.ImageMenuItem("Çıkış")
settingsButton = gtk.ImageMenuItem("Ayarlar")
kotaButton = gtk.ImageMenuItem("Kota")

exitButton.connect("activate", mainExit)
settingsButton.connect("activate", showSettings)
kotaButton.connect("activate", kota)

exitButton.show()
settingsButton.show()
kotaButton.show()

menu.append(kotaButton)
menu.append(settingsButton)
menu.append(exitButton)

def showMenu(icon, event, time):
	menu.popup(None, None, gtk.status_icon_position_menu, event, time, icon)

tray = gtk.status_icon_new_from_stock(gtk.STOCK_OK)
tray.connect("popup-menu", showMenu)
tray.connect("activate", kota)

gtk.main()